// viewport unit values for browsers with spotty support:
//   * vmin in IE9
//   * vmax in IE9, iOS <= 6
//   * calc(vh/vmin) in iOS < 8 and Android Stock Browser <= 4.4
//   * all of viewport units in Android Stock Browser <= 4.3
// var hacks = require('viewport-units-buggyfill/viewport-units-buggyfill.hacks')
// require('viewport-units-buggyfill').init({
//   hacks: hacks
// })

Promise.prototype.finally = function(callback) {
  let P = this.constructor
  return this.then(
    value => P.resolve(callback()).then(() => value),
    reason =>
      P.resolve(callback()).then(() => {
        throw reason
      })
  )
}

// ios :active 伪类不触发，需要在元素或者body上监听touchstart事件
document.body.addEventListener('touchstart', function() {
  // do some thing
})

// 全局输入框表情过滤
// document.body.addEventListener('input', function (e) {
//   let target = e.target
//   if (target.tagName === 'input' || target.tagName === 'TEXTAREA') {
//     target.value = target.value.replace(
//       /[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030/gi,
//       ''
//     )
//   }
// })
